<template>
	<view>
		<appBar title="设置">
		</appBar>
		<uv-gap height="10"></uv-gap>
		<view v-for="(item,index) in pageList" :key="index" class="defultBackground borderbottom pv20"
			@click="goPage(item.url)">
			<ListTitle :title="item.title" :rightText="item.subtitle"></ListTitle>
		</view>
		<uv-gap height="10"></uv-gap>
		<ThemeButton text="退出登录" @click="loginOut"></ThemeButton>
	</view>
</template>

<script>
	import {
		version
	} from '../../../../../package.json'
	import ListTitle from '@/components/ListTitle/ListTitle.vue';
	export default {
		components: {
			ListTitle
		},
		data() {
			return {
				pageList: [{
					title: '修改密码',
					subtitle: '',
					url: '/pages/tabbar/mine/page/setting/password/password',
				}, {
					title: '账号设置',
					subtitle: '',
					url: '/pages/tabbar/mine/page/setting/account/account',
				}, {
					title: '隐私权政策协议',
					subtitle: '',
					url: '/pages/tabbar/mine/page/setting/feedback/feedback',
				}, {
					title: '当前版本',
					subtitle: `版本号${version}`,
				}],
			}
		},
		onLoad() {},

		methods: {
			goPage(url) {
				if (url) {
					uni.navigateTo({
						url
					})
				}
			},
			loginOut() {
				uni.showModal({
					title: '提示',
					content: '确定退出登录吗？',
					success: (res) => {
						if (res.confirm) {
							uni.clearStorageSync();
							uni.reLaunch({
								url: '/pages/loginPage/loginPage'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			}
		}
	}
</script>

<style>

</style>